-
Notifications
You must be signed in to change notification settings - Fork 2k
[improve] Adjust CosFile connector instantiation #9121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
[improve] Adjust CosFile connector instantiation #9121
Conversation
@Override | ||
public void setTypeInfo(SeaTunnelRowType seaTunnelRowType) { | ||
this.seaTunnelRowType = seaTunnelRowType; | ||
this.fileSinkConfig = new FileSinkConfig(pluginConfig, seaTunnelRowType); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why delete this? We still have some sink should invoke it like OssFileSink
, HdfsFileSink
etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry,I neet to make adjustments according to purpose2 ,move the connector creation logic from Connector to ConnectorFactory.I don't know how to adjust it
(#8576 (comment))
@Override | ||
public List<CatalogTable> getProducedCatalogTables() { | ||
return SeaTunnelSource.super.getProducedCatalogTables(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should return catalog table in here to replace getProducedType
method.
(SeaTunnelSource<T, SplitT, StateT>) | ||
new CosFileSource( | ||
context.getOptions(), | ||
CatalogTableUtil.buildWithConfig(context.getOptions())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-1. We should build catalogtable with file sometimes. Please refer https://github.com/apache/seatunnel/pull/9121/files#diff-1f7ebddd2239c9ee909ee66c8f67c119b92f05324519ea5ce40d5aeab98da984L124
#8576 (comment) |
I used the factory class to create CosFileSource and CosFileLink connectors, but there is a check method testAllConnectorImplementeFactoryWithUpToDateMethod that does not allow deprecated methods, so I skipped the check. |
Please do not do that. The sub reason of #8576 is make sure all method up to date without deprecated method. |
If I don't skip the check method testAllConnectorImplementFactoryWithUpToDateMethod(),I must delete the method BaseFileSink.setTypeInfo(),otherwise, it cannot pass through. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
// adjusted the connector implementation,not deal with deprecated method yet | ||
blockList.add("CosFileSourceFactory"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider adding a space after the comma for clarity, e.g., 'connector implementation, not dealing with deprecated method yet'.
// adjusted the connector implementation,not deal with deprecated method yet | |
blockList.add("CosFileSourceFactory"); | |
// adjusted the connector implementation, not deal with deprecated method yet |
Copilot uses AI. Check for mistakes.
@Override | ||
public <T, SplitT extends SourceSplit, StateT extends Serializable> | ||
TableSource<T, SplitT, StateT> createSource(TableSourceFactoryContext context) { | ||
return () -> (SeaTunnelSource<T, SplitT, StateT>) new CosFileSource(context.getOptions()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding an annotation to suppress the unchecked cast warning or handling the cast more explicitly to ensure type safety.
return () -> (SeaTunnelSource<T, SplitT, StateT>) new CosFileSource(context.getOptions()); | |
SeaTunnelSource<?, ?, ?> source = new CosFileSource(context.getOptions()); | |
if (!(source instanceof SeaTunnelSource<T, SplitT, StateT>)) { | |
throw new ClassCastException("The created source is not compatible with the expected type."); | |
} | |
return () -> (SeaTunnelSource<T, SplitT, StateT>) source; |
Copilot uses AI. Check for mistakes.
Purpose of this pull request
subtask of #8576
Adjust CosFile connector instantiation
Does this PR introduce any user-facing change?
How was this patch tested?
Check list
New License Guide
release-note
.